{% extends 'layout.html' %}

{% block content %}

{% for content in contents%}
<div class="listBox">
    <h1>{{content.title}}</h1>
    <p class="colDefault">
        作者：<span class="colInfo">{{content.user.username}}</span> -
        时间：<span class="colInfo">{{content.addTime|date('Y-m-d H:i:s', -8*60)}}</span> -
        阅读：<span class="colInfo">{{content.views}}</span> -
        评论：<span class="colInfo">{{content.comments.length}}</span>
    </p>
    <dfn><p>{{content.description}}</p></dfn>
    <div class="function"><a href="/view?contend={{content.id}}">阅读全文</a></div>
</div>
{% endfor %}

<div class="pager">
    <ul class="clear">
        {% if page<=1 %}
        <li class="previous">
            <span>没有上一页<span>
        </li>
        {% else %}
        <li class="previous">
            <a href="/?category={{category}}&page={{page-1}}">上一页</a>
        </li>
        {% endif %}
        {% if pages>0 %}
        <li>
            <strong>{{page}}/{{pages}}</strong>
        </li>
        {% else %}
        <li>
            <strong>当前分类没有数据</strong>
        </li>
        {% endif %}
        {% if page >= pages %}
        <li class="next">
            <span>没有下一页</span>
        </li>
        {% else %}
        <li class="next">
            <a href="/?category={{category}}&page={{page+1}}">下一页</a>
        </li>
        {% endif %}
    </ul>
</div>



{% endblock %}